----------------------------------------------------------------------------------
-- Company:        Johns Hopkins University
-- Engineer:       Kevin Green
-- 
-- Create Date:    23:05:10 12/02/2011 
-- Design Name:    mask_lut_5
-- Module Name:    mask_lut_5 - RTL 
-- Project Name:   top_gillis_green
-- Target Devices: 
-- Tool versions: 
-- Description:    This is the 5-bit look-up table.  Given a the black and white
--                 vector, current move, and player, an output vector with the 
--                 mask positions is created.  This mask is used to clear the 
--                 opponents positions and set the players positions.
--
-- Dependencies: 
--
-- Revision: 
-- Revision 0.01 - File Created
-- Additional Comments: 
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use work.game_logic_pkg.all;

-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity mask_lut_5 is
    Port ( black : in  STD_LOGIC_VECTOR (7 downto 0);
           white : in  STD_LOGIC_VECTOR (7 downto 0);
           player : in  STD_LOGIC;
			  move : in STD_LOGIC_VECTOR (7 downto 0);
           data_out : out  STD_LOGIC_VECTOR (7 downto 0));
end mask_lut_5;

architecture RTL of mask_lut_5 is
begin

process(black, white, player, move) is
begin
	case(player & black & white & move) is
		when '0' & x"010204" => data_out <= x"02";
		when '0' & x"010608" => data_out <= x"06";
		when '0' & x"010a04" => data_out <= x"02";
		when '0' & x"010e10" => data_out <= x"0e";
		when '0' & x"011204" => data_out <= x"02";
		when '0' & x"011608" => data_out <= x"06";
		when '0' & x"011a04" => data_out <= x"02";
		when '1' & x"020104" => data_out <= x"02";
		when '0' & x"020408" => data_out <= x"04";
		when '1' & x"020401" => data_out <= x"02";
		when '0' & x"020508" => data_out <= x"04";
		when '1' & x"020904" => data_out <= x"02";
		when '0' & x"020c10" => data_out <= x"0c";
		when '1' & x"020c01" => data_out <= x"02";
		when '0' & x"020d10" => data_out <= x"0c";
		when '1' & x"021104" => data_out <= x"02";
		when '0' & x"021408" => data_out <= x"04";
		when '1' & x"021401" => data_out <= x"02";
		when '0' & x"021508" => data_out <= x"04";
		when '1' & x"021904" => data_out <= x"02";
		when '1' & x"021c01" => data_out <= x"02";
		when '0' & x"030408" => data_out <= x"04";
		when '0' & x"030c10" => data_out <= x"0c";
		when '0' & x"031408" => data_out <= x"04";
		when '0' & x"040201" => data_out <= x"02";
		when '1' & x"040208" => data_out <= x"04";
		when '1' & x"040308" => data_out <= x"04";
		when '0' & x"040810" => data_out <= x"08";
		when '1' & x"040802" => data_out <= x"04";
		when '0' & x"040910" => data_out <= x"08";
		when '1' & x"040902" => data_out <= x"04";
		when '0' & x"040a01" => data_out <= x"02";
		when '0' & x"040a10" => data_out <= x"08";
		when '0' & x"040b10" => data_out <= x"08";
		when '0' & x"041201" => data_out <= x"02";
		when '1' & x"041208" => data_out <= x"04";
		when '1' & x"041308" => data_out <= x"04";
		when '1' & x"041802" => data_out <= x"04";
		when '1' & x"041902" => data_out <= x"04";
		when '0' & x"041a01" => data_out <= x"02";
		when '1' & x"050208" => data_out <= x"04";
		when '0' & x"050810" => data_out <= x"08";
		when '1' & x"050802" => data_out <= x"04";
		when '0' & x"050a10" => data_out <= x"08";
		when '1' & x"051208" => data_out <= x"04";
		when '1' & x"051802" => data_out <= x"04";
		when '1' & x"060108" => data_out <= x"06";
		when '0' & x"060810" => data_out <= x"08";
		when '1' & x"060801" => data_out <= x"06";
		when '0' & x"060910" => data_out <= x"08";
		when '1' & x"061108" => data_out <= x"06";
		when '1' & x"061801" => data_out <= x"06";
		when '0' & x"070810" => data_out <= x"08";
		when '0' & x"080402" => data_out <= x"04";
		when '1' & x"080410" => data_out <= x"08";
		when '0' & x"080502" => data_out <= x"04";
		when '1' & x"080510" => data_out <= x"08";
		when '0' & x"080601" => data_out <= x"06";
		when '1' & x"080610" => data_out <= x"08";
		when '1' & x"080710" => data_out <= x"08";
		when '1' & x"081004" => data_out <= x"08";
		when '1' & x"081104" => data_out <= x"08";
		when '1' & x"081204" => data_out <= x"08";
		when '1' & x"081304" => data_out <= x"08";
		when '0' & x"081402" => data_out <= x"04";
		when '0' & x"081502" => data_out <= x"04";
		when '0' & x"081601" => data_out <= x"06";
		when '0' & x"090204" => data_out <= x"02";
		when '0' & x"090402" => data_out <= x"04";
		when '1' & x"090410" => data_out <= x"08";
		when '1' & x"090610" => data_out <= x"08";
		when '1' & x"091004" => data_out <= x"08";
		when '0' & x"091204" => data_out <= x"02";
		when '1' & x"091204" => data_out <= x"08";
		when '0' & x"091402" => data_out <= x"04";
		when '1' & x"0a0104" => data_out <= x"02";
		when '1' & x"0a0401" => data_out <= x"02";
		when '1' & x"0a0410" => data_out <= x"08";
		when '1' & x"0a0510" => data_out <= x"08";
		when '1' & x"0a1004" => data_out <= x"08";
		when '1' & x"0a1104" => data_out <= x"0a";
		when '1' & x"0a1401" => data_out <= x"02";
		when '1' & x"0b0410" => data_out <= x"08";
		when '1' & x"0b1004" => data_out <= x"08";
		when '0' & x"0c0201" => data_out <= x"02";
		when '1' & x"0c0210" => data_out <= x"0c";
		when '1' & x"0c0310" => data_out <= x"0c";
		when '1' & x"0c1002" => data_out <= x"0c";
		when '1' & x"0c1102" => data_out <= x"0c";
		when '0' & x"0c1201" => data_out <= x"02";
		when '1' & x"0d0210" => data_out <= x"0c";
		when '1' & x"0d1002" => data_out <= x"0c";
		when '1' & x"0e0110" => data_out <= x"0e";
		when '1' & x"0e1001" => data_out <= x"0e";
		when '0' & x"100804" => data_out <= x"08";
		when '0' & x"100904" => data_out <= x"08";
		when '0' & x"100a04" => data_out <= x"08";
		when '0' & x"100b04" => data_out <= x"08";
		when '0' & x"100c02" => data_out <= x"0c";
		when '0' & x"100d02" => data_out <= x"0c";
		when '0' & x"100e01" => data_out <= x"0e";
		when '0' & x"110204" => data_out <= x"02";
		when '0' & x"110608" => data_out <= x"06";
		when '0' & x"110804" => data_out <= x"08";
		when '0' & x"110a04" => data_out <= x"0a";
		when '0' & x"110c02" => data_out <= x"0c";
		when '1' & x"120104" => data_out <= x"02";
		when '0' & x"120408" => data_out <= x"04";
		when '1' & x"120401" => data_out <= x"02";
		when '0' & x"120508" => data_out <= x"04";
		when '0' & x"120804" => data_out <= x"08";
		when '0' & x"120904" => data_out <= x"08";
		when '1' & x"120904" => data_out <= x"02";
		when '1' & x"120c01" => data_out <= x"02";
		when '0' & x"130408" => data_out <= x"04";
		when '0' & x"130804" => data_out <= x"08";
		when '0' & x"140201" => data_out <= x"02";
		when '1' & x"140208" => data_out <= x"04";
		when '1' & x"140308" => data_out <= x"04";
		when '1' & x"140802" => data_out <= x"04";
		when '1' & x"140902" => data_out <= x"04";
		when '0' & x"140a01" => data_out <= x"02";
		when '1' & x"150208" => data_out <= x"04";
		when '1' & x"150802" => data_out <= x"04";
		when '1' & x"160108" => data_out <= x"06";
		when '1' & x"160801" => data_out <= x"06";
		when '0' & x"180402" => data_out <= x"04";
		when '0' & x"180502" => data_out <= x"04";
		when '0' & x"180601" => data_out <= x"06";
		when '0' & x"190204" => data_out <= x"02";
		when '0' & x"190402" => data_out <= x"04";
		when '1' & x"1a0104" => data_out <= x"02";
		when '1' & x"1a0401" => data_out <= x"02";
		when '0' & x"1c0201" => data_out <= x"02";
		when others => data_out <= x"00";
	end case;
end process;



end RTL;

